<!--<zjy-qrcode :text="'1242334'" />-->

<template>
	<view :class="['flex-a', opacityClass]">
		<image
			:style="{ width: width + 'rpx', height: height + 'rpx' }"
			v-if="text"
			:src="tempFilePath"
			mode="aspectFit"
			:lazy-load="true"
		></image>
	</view>
</template>

<script lang="ts" setup>
import { ref, onMounted } from "vue"

const props = defineProps({
	width: {
		type: Number,
		default: 240,
	},
	height: {
		type: Number,
		default: 240,
	},
	text: {
		// 二维码内容
		type: String,
		default: "",
	},
	opacity: {
		type: Boolean,
		default: false,
	},
})

const tempFilePath = ref("")
const opacityClass = ref(props.opacity ? "opacity" : "")

onMounted(() => {
	tempFilePath.value = "https://wx.zhijingyou.com/qrcode?site_code=" + props.text
})
</script>

<style lang="scss" scoped>
.opacity {
	opacity: 0.1;
}
</style>
